import loading from './loading.vue';
export default{
    install:function(Vue,options){
        //创建一个Vue子类
        var VueLoad = Vue.extend(loading);
        var loadEl = null;
         
        function loadingShow (){
            //是否已经挂载load组件
            if (!loadEl) {
                loadEl = new VueLoad();
                loadEl.$mount();
                document.querySelector(options.container||'body').appendChild(loadEl.$el);
            }
            loadEl.loading();
        }
        function loadingEnd(){
            loadEl.loadEnd();
        }
        //将方法挂到vue实例上
         Vue.prototype.loading =  loadingShow;
        Vue.prototype.loadEnd = loadingEnd;

    }
}